How many runs can you score by just aiming for four balls.

Takuji Anekawa, Tetsuro Shiba, Hiroshi Matsui, Toshiyuki Yamauchi and Ryohei Miyadera.

Team A is going to play against Team B. The only pitcher of Team B can throw about a 100 mile an hour fastball, but he is not good at　controlling it. Therefore the members of Team A are going to try to get four balls without hitting a ball. As a result of this strategy each batsman will get either four balls or a strike out.
We will suppose that the pitcher throws a ball or a strike with the same probability.

Problem.  (1) Calculate the probability of a batsman getting a strike out.
(2) Calculate the probability of Team A scoring a run in an inning.
(3) Calculate the probability of Team A scoring 2 runs in an inning.
(4) Calculate the probability of Team A scoring more than 6 runs in an inning.
(5) Calculate the probability of Team A scoring 2 runs in a game.

Now we will change the situation, and we suppose that the pitcher throws a strike with a fixed probability x with a condition 0 < x < 1.
(6) If you want the expected number of runs to be 3 in a game, what probability would the pitcher need to throw a strike with?

Remark. Problem (1) is a well known, and you can find it in a book by Fujimura and Tamura [1], but the authors have not found problems similar to Problem (2), (3), (4), (5) and (6).

An answer to the problem.

We assume that the pitcher throws a strike with probability x. We let x = (1/2)for (1),(2),(3),(4),(5).

Definition 1. We denote by strike[x] the probability of team A getting a strike out when the pitcher throws a strike with the probability x.

Theorem  1.  strike (x) =(x^3)+3(Subscript[C, 1])(x^3)(((1 - x))^1)+(Subscript[, 4])(Subscript[C, 2])(x^3)(((1 - x))^2)+ (Subscript[, 5])(Subscript[C, 3])(x^3)(((1 - x))^3).

Proof.

If a batsman is to get a strike out, there are 4 cases for that.
(1) He gets a strike out while he gets no ball. The probability for this is (x^3).
(2) He gets a strike out while he gets a ball. The probability for this is 3  (Subscript[C, 1])(x^3)(((1 - x))^1).
(3) He gets a strike out while he gets two balls. The probability for this is (Subscript[, 4])(Subscript[C, 2])(x^3)(((1 - x))^2).
(4) He gets a strike out while he gets three balls. The probability for this is (Subscript[, 5])(Subscript[C, 3])(x^3)(((1 - x))^3).
By adding the above probabilities we get
strike (x) =(x^3)+3(Subscript[C, 1])(x^3)(((1 - x))^1)+(Subscript[, 4])(Subscript[C, 2])(x^3)(((1 - x))^2)+ (Subscript[, 5])(Subscript[C, 3])(x^3)(((1 - x))^3).

An answer to Problem (1).

By Theorem 1 we have strike(x) =(x^3)+3(Subscript[C, 1])(x^3)(((1 - x))^1)+(Subscript[, 4])(Subscript[C, 2])(x^3)(((1 - x))^2)+ (Subscript[, 5])(Subscript[C, 3])(x^3)(((1 - x))^3), and hence
strike (1/2)= 21/32.

Mathematica calculation for Problem (1).

A Mathematica function for strike(x).

strike[x_]:=(x^3)+Binomial[3, 1](x^3)(((1 - x))^1)+Binomial[4, 2](x^3)(((1 - x))^2)+Binomial[5, 3](x^3)(((1 - x))^3);

Calculation by this Mathematica function

strike[1/2]

(21/32) // N

Calculation by a computer simulation.

We did a computer simulation for this problem. It is bette to use more than two ways to calculate probabilities, since is not easy to avoid mistakes in this kind of problem.

strikeout = 0; 
    Do[s = 0; b = 0; 
      While[s < 3 && b < 4, x = Random[Integer]; s = s + x; 
        b = b + (1 - x)]; 
      If[s == 3, strikeout = strikeout + 1, ], {n, 1, 
        100000}];
  strikeout

65775/100000 // N

The answer we got by mathematical theory is approximately equal to the answer we got by computer simulation.

\(Throughout\ this\ article\ we\ will\ suppose\ that\ each\ batsman\ gets\ a\ strike\ out\ with\ the\ probability\ \ p, \ 
    and\ hence\ he\ gets\ four\ balls\ with\ a\ probability\ of\ 1 - \(\(p\)\(.\)\(\ \ \)\)\)

Definition 2. We denote by  score1(p, m) the probability of Team A getting m points in an inning.

Theorem 2.  score1 (p, m) ={({{\(\(\(\_\(5 + 
                                m\)\)\(C\_2\) \(p\^3\) \((1 - p)\)\^\(3 + m\)\ \ \ when\ m\)\(\ \)\(>\)\(\ \)\(0.\)\(\ \ \)\)}, {\(∑\+\(h = 2\)\%5\(\_h\)\(C\_2\) \(p\^3\) \((1 - p)\)\^\(h - 2\)\ when\ m\  = \ 0. \)}})

Proof.

(1) First we suppose that when m  >  
        0.  If Team A is to get k points, the team have to get k + 
        3 four balls before getting 3 strikes out .  
            The last batsman should get a strike out, \(and\ hence\ there\ should\ be\ 2\ batsmen\ who\ get\ strikes\ out\ among\ \((k + 3)\) + 2\) =\(k + 
            5  batmen . \ 
                Therefore\ the\ number\ of\ combinations\ is\ \(\_\(5 + k\)\)\(C\_2\) . \ 
                For\ each\ case\ the\ probability\ is\ \(p\^2\) \((1 - p)\)\^\(3 + k\)*p\)= (p^3)(((1 - p))^(3 + k)). Thereforescore1(p, m) = \(\(\_\(5 + 
                        k\)\)\(C\_2\) \(p\^3\) \((1 - p)\)\^\(3 + k\)\ for\ m\  > \ 0. \)

\(\((2)\) Next\ we\ suppose\ that\ m\  = \ 
      0. \ If\ Team\ A\ is\ to\ get\ no\ point, 
    the\ team\ have\ to\ get\ \ 3\ strikes\ out\ without\ getting\ more\ than\ 3\ four\ balls . \ 
        The\ last\ batter\ should\ get\ a\ strike\ \(\(out\)\(.\)\)\)

\(\((2 - 
          1)\)\ The\ probability\ of\ Team\ A\ getting\ no\ four\ balls\ is\ p\^3\)

\(\((2 - 2)\) 
      The\ probability\ of\ Team\ A\ getting\ only\ one\ four\ balls\ is\ \(\_3\)\(C\_2\) \(p\^3\) \(\((1 - 
            p)\)\(.\)\)\)

\(\((2 - 3)\) 
      The\ probability\ of\ Team\ A\ getting\ two\ four\ balls\ is\ \(\_4\)\(C\_2\) \(p\^3\) \(\((1 - p)\)\^2\) 
      the\ \(\(team\)\(\ \)\(.\)\)\)

\(\((2 - 4)\) 
      The\ probability\ of\ Team\ A\ getting\ three\ four\ balls\ is\ \(\_5\)\(C\_2\) \(p\^3\) \(\((1 - p)\)\^3\) 
      the\ \(\(team\)\(\ \)\(.\)\)\)

By adding the above probabilities we get
score1 (p, m)=\(∑\+\(h = 2\)\%5\(\_h\)\(C\_2\) \(p\^3\) \((1 - p)\)\^\(h - 2\)\ for\ m\  = \ 0. \)

An answer to Problem (2).

\(By\ Problem\ \((1)\)\ we\ know\ that\ the\ probability\ of\ each\ batsman\ getting\ a\ strike\ out\ is\ 21/
            32. \ By\ Theorem\ 2\ we\ have\ score1 \((p, 
            m)\)\  = \(\_\(5 + 
                    m\)\)\(C\_2\) \(p\^3\) \((1 - p)\)\^\(3 + m\)\ \ for\ m\  > \ 0. \ \ Therefore\) 
the answer of Problem (1) is score1(21/32, 1) = \(\(\_6\)\(C\_2\) \(\((21/
                  32)\)\^3\) \((1 - 21/32)\)\^4\ \  = \(2033854515\/34359738368 = \ \(\(0.059192956978222355`\)\(.\)\)\)\)

Mathematica calculation for Problem (2)

A Mathematica function for score1[p,m].

Clear[score1]; 
    score1[p_, m_] := 
      If[m > 0, 
        Binomial[5 + m, 2]*
          p^3*(1 - p)^(3 + m), (∑_(h = 2)^5) Binomial[h, 2]*
            p^3*(1 - p)^(h - 2)]

Calculation by this function.

score1[21/32, 1] // N

Calculation by a computer simulation.

We did a computer simulation for this problem. We used ThinkPad X60S (core duo 1.5Mz), and it took us 6 seconds to do this simulation.

times1 = 0;Do[s = 0; b = 0; 
      While[s < 3, x = If[Random[Real, {0, 1}, 4] > 11/32, 1, 0]; s = s + x; 
        b = b + (1 - x)]; 
      If[Max[b - 3, 0] == 1, times1 = times1 + 1, ], {n, 1, 
        100000}];

times1/100000 // N

The answer we got by mathematical theory is approximately equal to the answer we got by computer simulation.

An answer to Problem (3).

We have p = 21/32  score1(p, m) =\(\(\_\(5 + 
                      m\)\)\(C\_2\) \(p\^3\) \((1 - p)\)\^\(3 + m\)\ \ for\ m\  > \ 0. \ \ Therefore\) 
the answer of Problem 3 is score1(21/32, 2) = \(\(\_7\)\(C\_2\) \(\((21/
                  32)\)\^3\) \((1 - 21/32)\)\^5\ \  = \(31321359531\/1099511627776 = \(\(0.02848661054576951`\)\(.\)\)\)\)

Mathematica calculation for Problem (3)

A Mathematica function for score1[p,m].

Clear[score1]; 
    score1[p_, m_] := 
      If[m > 0, 
        Binomial[5 + m, 2]*
          p^3*(1 - p)^(3 + m), (∑_(h = 2)^5) Binomial[h, 2]*
            p^3*(1 - p)^(h - 2)]

Calculation by this function.

score1[21/32, 2] // N

Calculation by a computer simulation.

We did a computer simulation for this problem.

times2 = 0;Do[s = 0; b = 0; 
      While[s < 3, x = If[Random[Real, {0, 1}, 4] > 11/32, 1, 0]; s = s + x; 
        b = b + (1 - x)]; 
      If[Max[b - 3, 0] == 2, times2 = times2 + 1, ], {n, 1, 
        100000}];

times2/100000 // N

The answer we got by mathematical theory is approximately equal to the answer we got by computer simulation.

An answer to Problem (4).

By Theorem 2 we have score1(p, m) =(Subscript[, 5 + 
                    m])(Subscript[C, 2]) (p^3) (((1 - p))^(3 + m))  for m > 0  and score1(p, 0) = \(∑\+\(h = 2\)\%5\(\_h\)\(C\_2\) \(p\^3\) \(\(\((1 - 
                      p)\)\^\(h - 2\)\)\(.\)\)\)

The answer of Problem 4 is 1-(∑_(m = 0)^6)score1 (21/32, m)= 1 - ((477413811/536870912) + (2033854515/34359738368) + 
            (31321359531/1099511627776) + (114844984947/8796093022208) + 
            (1624236215679/281474976710656) + 
            (89332991862345/36028797018963968) + 
            (1201032446149305/1152921504606846976))

\(\(\(
\)\(\(=\)\(\ \)\(1 - 
          1152091532957039577\/1152921504606846976 = \(829971649807399\/1152921504606846976 = \ \(\(0.0007198856526580482`\)\(.\)\)\)\)\)\)\)

Mathematica calculation for Problem (4).

1 - (∑_(n = 0)^6) score1[(21/32), n] // N

Calculation by a computer simulation.

We did a computer simulation for this problem.

times = 0;Do[s = 0; b = 0; 
      While[s < 3, x = If[Random[Real, {0, 1}, 4] > 11/32, 1, 0]; s = s + x; 
        b = b + (1 - x)]; 
      If[Max[b - 3, 0] > 6, times = times + 1, ], {n, 1, 
        100000}];

times/100000 // N

The answer we got by mathematical theory is approximately equal to the answer we got by computer simulation.

Comment. If you want to calculate the probability of Team A scoring m runs in a game with m > 2, then you have to use all the partitions of the integer m.

An answer to Problem (5).

(a) Suppose that Team A scores two runs in an inning, and does not score a run in other innings.

There are 9 cases for this.

{2,0,0,0,0,0,0,0,0},{0,2,0,0,0,0,0,0,0},{0,0,2,0,0,0,0,0,0},{0,0,0,2,0,0,0,0,0},{0,0,0,0,2,0,0,0,0},{0,0,0,0,0,2,0,0,0},{0,0,0,0,0,0,2,0,0},{0,0,0,0,0,0,0,2,0},{0,0,0,0,0,0,0,0,2}

Therefore for (a) the probability is 9((score1(p, 0))^8)×score1(p,2)= 9×((score1(21/32,0))^8)×score1(21/32,2) = \(760751718128177647606353894081815083420438358204635285035132161282405016938956899\/7588550360256754183279148073529370729071901715047420004889892225542594864082845696\)= 0.10025.

(b) Suppose that Team A scores a run in two of the 9 innings, and does not score a run in other innings.

There are 36 cases for this.

{1,1,0,0,0,0,0,0,0},{1,0,1,0,0,0,0,0,0},{1,0,0,1,0,0,0,0,0},{1,0,0,0,1,0,0,0,0},{1,0,0,0,0,1,0,0,0},{1,0,0,0,0,0,1,0,0},{1,0,0,0,0,0,0,1,0},{1,0,0,0,0,0,0,0,1},{0,1,1,0,0,0,0,0,0},{0,1,0,1,0,0,0,0,0},{0,1,0,0,1,0,0,0,0},{0,1,0,0,0,1,0,0,0},{0,1,0,0,0,0,1,0,0},{0,1,0,0,0,0,0,1,0},{0,1,0,0,0,0,0,0,1},{0,0,1,1,0,0,0,0,0},{0,0,1,0,1,0,0,0,0},{0,0,1,0,0,1,0,0,0},{0,0,1,0,0,0,1,0,0},{0,0,1,0,0,0,0,1,0},{0,0,1,0,0,0,0,0,1},{0,0,0,1,1,0,0,0,0},{0,0,0,1,0,1,0,0,0},{0,0,0,1,0,0,1,0,0},{0,0,0,1,0,0,0,1,0},{0,0,0,1,0,0,0,0,1},{0,0,0,0,1,1,0,0,0},{0,0,0,0,1,0,1,0,0},{0,0,0,0,1,0,0,1,0},{0,0,0,0,1,0,0,0,1},{0,0,0,0,0,1,1,0,0},{0,0,0,0,0,1,0,1,0},{0,0,0,0,0,1,0,0,1},{0,0,0,0,0,0,1,1,0},{0,0,0,0,0,0,1,0,1},{0,0,0,0,0,0,0,1,1}

Therefore for (b) the probability is 36((score1(p, 0))^7)×((score1(p, 1))^2) = 36((score1(21/32,0))^7)×((score1(21/32,1))^2)
= \(210449126003223807969096560345835582245724093221907063819274859570456110913551275\/3794275180128377091639574036764685364535950857523710002444946112771297432041422848\)= 0.0554649.

Therefore the answer is 0.10025 +  0.0554649 = 0.155715.

Mathematica calculation for Problem (5).

Clear[score1]; 
    score1[p_, m_] := 
      If[m > 0, 
        Binomial[5 + m, 2]*
          p^3*(1 - p)^(3 + m), (∑_(h = 2)^5) Binomial[h, 2]*
            p^3*(1 - p)^(h - 2)]

Mathematica calculation for(a).

9*score1[21/32, 0]^8*score1[21/32, 2] // N

Mathematica calculation for (b).

36  score1[21/32, 0]^7*score1[21/32, 1]^2 // N

To get the answer to Problem (5) we have to add the probabilities of (a) and (b).

9*score1[21/32, 0]^8*score1[21/32, 2] + 
        36  score1[21/32, 0]^7*score1[21/32, 1]^2 // N

We did a computer simulation for this problem. We used ThinkPad X60S (core duo 1.5Mz + 512MB), and it took us 70 seconds to do this simulation.

game1 = 0; 
    Do[score = 0; 
      Do[s = 0; b = 0; 
        While[s < 3, x = If[Random[Real, {0, 1}, 4] > 11/32, 1, 0]; 
          s = s + x; b = b + (1 - x)]; 
        score = score + Max[b - 3, 0], {n, 1, 9}]; 
      If[score == 2, game1 = game1 + 1, ], {nn, 1, 100000}];

game1/100000 // N

The answer we got by mathematical theory is approximately equal to the answer we got by computer simulation.

Definition 3. We denote by  score9(p, m) the probability of Team A getting m points in a game.

In Appendix we are going to present a Mathematica function for score9(p, m).

Theorem 3. When we fix the probability p, then the expectation  of score1(p, m) is ((3 (((p - 1))^4) (1 + 2 p + 
                    2 (p^2)))/p).

Proof.

E(score1(p, m))=(∑_(m = 1)^∞)score1(p, m)= (∑_(m = 1)^∞)m(Subscript[, 5 + 
                          m])(Subscript[C, 2])(p^3)(((1 - p))^(3 + m))

=(∑_(m = 1)^∞)((m (5 + m) (4 + m))/2)(p^3)(((1 - p))^(3 + m))....(1)

By substituting p by 1 - q 
(1)  = (∑_(m = 1)^∞)(( 
                m (5 + m) (4 + m))/2) (((1 - q))^3) 
          (q^(3 + m))
\(\(\(=\)\(\(q\^3\) \(\((1 - 
                q)\)\^3\) \((\(∑\+\(m = 1\)\%∞\( m\^3\) q\^m\)\/2 + \(9 \(∑\+\(m = 1\)\%∞\( m\^2\) q\^m\)\)\/2 + 
            10 \(∑\+\(m = 1\)\%∞ mq\^m\))\)

      \(\(=\)\(\(q\^3\) \(\((1 - 
                  q)\)\^3\) \((\(q + 4\ q\^2 + q\^3\)\/\(2 \((q - 1)\)\^4\) - \(9  q\ \((q + 1)\)\)\/\(2 \((q - 1)\)\^3\) + \(10  q\)\/\((q - 1)\)\^2)\)\)\)\)\)\)
\(\(\(=\)\(\(\(3\ q\^4\ \((5 - 6\ q + 2\ q\^2)\)\)\/\(1 - q\) ... \) . \((2)\) . \)\)\)

By substituting q by 1 - p we get
(2)  =  ((3 (((p - 1))^4) (1 + 2 p + 
                  2 (p^2)))/p).

An answer to Problem 6.

By the property of expectation we have  E(score9(p,m)) = 9E(score1(p,m)).
Therefore we only have to find p such that E(score1(p,m))= (1/3).

By Theorem 3 E(score1(p,m))= ((3 (((p - 1))^4) (1 + 2 p + 2 (p^2)))/p)= (1/3), and hence we have to solve the equation numerically. We used the computer algebra system Mathematica and got p = 1.37734 and p = 0.611123. Since 0 < p < 1 we got p = 0.611123.

Next we are going to find x such that p = strike(x)=  0.611123, and hence we have to solve (x^3)+3(Subscript[C, 1])(x^3)(((1 - x))^1)+(Subscript[, 4])(Subscript[C, 2])(x^3)(((1 - x))^2)+ (Subscript[, 5])(Subscript[C, 3])(x^3)(((1 - x))^3)= 0.611123 numerically. Similarly by Mathematica we got x = 1.35404 and x = 0.476451. Since 0 < x < 1 we got x = 0.476451.

Mathematica calculation for Problem 6.

Mathematica calculation to get the probability p.

NSolve[((3 (((p - 1))^4) (1 + 2 p + 2 (p^2)))/p)==(1/3),p]

Since 0 < p < 1, we get p = 0.611123.

Next we are going to get probability x.

NSolve[(x^3)+Binomial[3, 1](x^3)(((1 - x))^1)+Binomial[4, 2](x^3)(((1 - x))^2)+Binomial[5, 3](x^3)(((1 - x))^3)==0.611123,x]

We get x = 0.476451, since 0 < x < 1.

Appendix.

We denote by score9[x] the probability of team A scoring m runs in a game, and make a Mathematica function for score9(p, m).

By studying Problem (5) carefully you can make a Mathematica function to calculate score9[x]

A Mathematica function to calculate score9[p,m]. We use a function Partitions[n] defined by S.Skiena [2] and [3].

\(\(\( (*This\ function\ Partitions[]\ is\ made\ by\ S . 
          Skiena*) \)\(Partitions[n_Integer] := Partitions[n, n]

    Partitions[n_Integer, _] := {} /; \((n < 0)\)

    Partitions[0, _] := {{}}

    Partitions[n_Integer, 1] := {Table[1, {n}]}

    Partitions[_, 0] := {}

    \(Partitions[n_Integer, maxpart_Integer] := 
        Block[{$RecursionLimit = Infinity}, 
          Join[Map[\((Prepend[#, maxpart])\) &, 
              Partitions[n - maxpart, maxpart]], 
            Partitions[n, maxpart - 1]]];\)

    Clear[score1]; 
    score1[p_, m_] := 
      If[m > 0, 
        Binomial[5 + m, 2]*
          p^3*\((1 - p)\)^\((3 + m)\), ∑\+\(h = 2\)\%5 Binomial[h, 2]*
            p^3*\((1 - p)\)^\((h - 2)\)];

    Clear[pro]; 
    pro[p_, x_List] := 
      Block[{s}, s = Length[x]; t = 9 - s; 
        score1[p, 0]^t*\((∏\+\(k = 1\)\%s score1[p, x[\([k]\)]])\)*
          Length[Permutations[
              Join[x, Table[0, {n, 1, t}]]]]];

    Clear[score9]; 
    score9[p_, n_] := 
      If[n > 0, 
        Apply[Plus, 
          Map[\((pro[p, #])\) &, Select[Partitions[n], Length[#] < 10 &]]], 
        score1[p, 0]^9]\)\)\)

score9[21/32, 2] // N

We did a computer simulation to calculate score9(p,m), and compare it to the calculation by a Mathematica function. We used ThinkPad X60S (core duo 1.5Mz + 512MB), and it took us 100 seconds to do this simulation.
In the following simulation Team A gets 0, 1, 2, 3, 4, 5, 6, 7, 8 runs s0, s1, s2, s3, s4, s5, s6, s7, s8 times in 100000 trials.

s0 = 0; s1 = 0; s2 = 0; s3 = 0; s4 = 0; s5 = 0; s6 = 0; s7 = 0; s8 = 0; 
    Do[score = 0; 
      Do[s = 0; b = 0; 
        While[s < 3, x = If[Random[Real, {0, 1}, 4] > 11/32, 1, 0]; 
          s = s + x; b = b + (1 - x)]; 
        score = score + Max[b - 3, 0], {n, 1, 9}]; 
      Which[score == 0, s0 = s0 + 1, score == 1, s1 = s1 + 1, 
        score == 2, s2 = s2 + 1, score == 3, s3 = s3 + 1, 
        score == 4, s4 = s4 + 1, score == 5, s5 = s5 + 1, 
        score == 6, s6 = s6 + 1, score == 7, s7 = s7 + 1, 
        score == 8, s8 = s8 + 1], {nn, 1, 100000}];

{s0, s1, s3, s4, s5, s6, s7, s8}/100000 // N

Table[score9[21/32, n], {n, 0, 8}] // N

The result we got by mathematical theory is approximately equal to the result we got by computer simulation.

References

[1] K.Fujimura and S.Tamura, Introduction to mathematics of puzzle (In Japanese), Kodansha publ.

[2] S. Skiena,Implementing Discrete Mathematics: Combinatorics and Graph Theory with Mathematica, Advanced Book Division, Addison-Wesley, Redwood City CA, June 1990.

[3] S. Skiena,Latest version of Combinatorica,http://www.cs.sunysb.edu/~skiena/combinatorica/index.html